package com.jl.jlapp.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jl.jlapp.R;
import com.jl.jlapp.eneity.OrderListModel;

import java.text.DecimalFormat;
import java.util.List;

public class MyOrderListAdapter
  extends BaseQuickAdapter<OrderListModel.ResultDataBean, BaseViewHolder>
{
  public MyOrderListAdapter(@LayoutRes int paramInt, @Nullable List<OrderListModel.ResultDataBean> paramList)
  {
    super(paramInt, paramList);
  }
  
  protected void convert(BaseViewHolder paramBaseViewHolder, OrderListModel.ResultDataBean paramResultDataBean)
  {
    Object localObject = (TextView)paramBaseViewHolder.getView(R.id.my_order_item_bottom_btn2);
    ((TextView)localObject).setVisibility(View.GONE);
    paramBaseViewHolder.setText(R.id.my_order_no, paramResultDataBean.getOrderNo());
    double d;
    switch (paramResultDataBean.getOrderState())
    {
    default: 
      localObject = (ImageView)paramBaseViewHolder.getView(R.id.goods_img);
      Glide.with(paramBaseViewHolder.itemView.getContext()).asBitmap().apply(new RequestOptions().placeholder(R.drawable.img_noimg_xs).error(R.drawable.img_lose_xs)).load("http://117.158.178.202:8001/JLMIS/" + ((OrderListModel.ResultDataBean.OrderDetailsBean)paramResultDataBean.getOrderDetails().get(0)).getGoodsCoverUrl()).into((ImageView)localObject);
      paramBaseViewHolder.setText(R.id.goods_name, ((OrderListModel.ResultDataBean.OrderDetailsBean)paramResultDataBean.getOrderDetails().get(0)).getGoodsName());
      paramBaseViewHolder.setText(R.id.goods_price, ((OrderListModel.ResultDataBean.OrderDetailsBean)paramResultDataBean.getOrderDetails().get(0)).getGoodsOriginalPrice() + "");
      paramBaseViewHolder.setText(R.id.my_order_goods_specification, ((OrderListModel.ResultDataBean.OrderDetailsBean)paramResultDataBean.getOrderDetails().get(0)).getGoodsSpecificationName());
      paramBaseViewHolder.setText(R.id.my_order_goods_num, ((OrderListModel.ResultDataBean.OrderDetailsBean)paramResultDataBean.getOrderDetails().get(0)).getGoodsQuantity() + "");
      paramBaseViewHolder.setText(R.id.my_order_freight, paramResultDataBean.getPostage() + "");
      localObject = new DecimalFormat(".00");
      d = paramResultDataBean.getOrderPresentPrice() + paramResultDataBean.getPostage();
      if (d > 1.0D) {
        paramBaseViewHolder.setText(R.id.my_order_combined_num, ((DecimalFormat)localObject).format(d) + "");
      }
      break;
    }
    int j;
    for (;;)
    {
      j = 0;
      int i = 0;
      while (i < paramResultDataBean.getOrderDetails().size())
      {
        j += ((OrderListModel.ResultDataBean.OrderDetailsBean)paramResultDataBean.getOrderDetails().get(i)).getGoodsQuantity();
        i += 1;
      }
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.for_the_payment);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.pay_money);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.to_send_the_goods);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.order_tracking);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.for_the_goods);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.order_tracking);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, "确认收货");
      ((TextView)localObject).setVisibility(View.VISIBLE);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.has_been_completed);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.once_again_to_buy);
      if (paramResultDataBean.getIsHasEvaluation() == 0) {
        paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_of_printing);
      }else
      {
        ((TextView)localObject).setVisibility(View.VISIBLE);
        if (paramResultDataBean.getIsHasEvaluation() == 1) {
          paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_detail);
        }
      }
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.has_been_cancelled);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.once_again_to_buy);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.has_closed);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.once_again_to_buy);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.in_the_after_sale);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.order_tracking);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.has_closed);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.once_again_to_buy);
      if (paramResultDataBean.getIsHasEvaluation() == 0)
      {
        paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_of_printing);
        break;
      }
      if (paramResultDataBean.getIsHasEvaluation() != 1) {
        break;
      }
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_detail);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.has_closed);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.once_again_to_buy);
      if (paramResultDataBean.getIsHasEvaluation() == 0)
      {
        paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_of_printing);
        break;
      }
      if (paramResultDataBean.getIsHasEvaluation() != 1) {
        break;
      }
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_detail);
      paramBaseViewHolder.setText(R.id.my_order_state, "审核中");
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.order_tracking);
      paramBaseViewHolder.setText(R.id.my_order_state, R.string.has_closed);
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn1, R.string.once_again_to_buy);
      if (paramResultDataBean.getIsHasEvaluation() == 0)
      {
        paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_of_printing);
        break;
      }
      if (paramResultDataBean.getIsHasEvaluation() != 1) {
        break;
      }
      paramBaseViewHolder.setText(R.id.my_order_item_bottom_btn2, R.string.evaluation_detail);
      paramBaseViewHolder.setText(R.id.my_order_combined_num, Double.parseDouble(((DecimalFormat)localObject).format(d)) + "");
    }
    paramBaseViewHolder.setText(R.id.my_order_combined_goods_num, j + "");
    paramBaseViewHolder.addOnClickListener(R.id.my_order_item_bottom_btn1);
    paramBaseViewHolder.addOnClickListener(R.id.my_order_item_bottom_btn2);
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/adapter/MyOrderListAdapter.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */